from drf_spectacular.extensions import OpenApiAuthenticationExtension
from token_blacklist.authentication import CustomJWTAuthentication

class CustomJWTAuthenticationScheme(OpenApiAuthenticationExtension):
    target_class = CustomJWTAuthentication  # 指定目标认证类
    name = "CustomJWT"  # 在 OpenAPI 文档中显示的名称
    
    def get_security_definition(self, auto_schema):
        return {
            "type": "http",
            "scheme": "bearer",
            "bearerFormat": "JWT",
            "description": "Custom JWT authentication with blacklist support"
        }
